//
//  ViewController.m
//  14-运行时关联对象
//
//  Created by apple on 16/1/8.
//  Copyright © 2016年 apple. All rights reserved.
//


#import "ViewController.h"
#import "UIImageView+web.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    UIImageView *img = [[UIImageView alloc] init];
    img.lastUrl = @"haha";
    NSLog(@"%@",img.lastUrl);
    [self uiConfig];
    
    
}

- (void)uiConfig{
    //第一个按钮
    UIButton *button1 = [UIButton createBtnWithFrame:CGRectMake((ScreenWidth - 100)/2, (ScreenHeight - 50)/2 - 50, 100, 50) title:@"按钮" actionBlock:^(UIButton *button) {
        CGFloat r = random()%255/255.0;
        CGFloat g = random()%255/255.0;
        CGFloat b = random()%255/255.0;
        self.view.backgroundColor = [UIColor colorWithRed:r green:g blue:b alpha:0.5];
    }];
    button1.backgroundColor = [UIColor lightGrayColor];
    [self.view addSubview:button1];
    
    //第二个按钮
    UIButton *button2 = [UIButton createBtnWithFrame:CGRectMake((ScreenWidth - 100)/2, CGRectGetMaxY(button1.frame) + 50, 100, 50) title:@"按钮2" actionBlock:nil];
    button2.actionBlock = ^(UIButton *button){
        NSLog(@"---%@---",button.currentTitle);
    };
    button2.backgroundColor = [UIColor lightGrayColor];
    [self.view addSubview:button2];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
